package com.heima.user.feign;

import com.heima.client.user.IApUserClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.pojos.user.ApUser;
import com.heima.user.service.ApUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Lijx
 * @Date 2024-08-01 16:41
 */
@RestController
@RequestMapping("/api/v1/info")
@Slf4j
public class ApUserClient implements IApUserClient {

    @Autowired
    private ApUserService userService;

    /**
     * 查询APP当前登录用户信息
     * @param userId
     * @return
     */
    @GetMapping("/{userId}")
    public ResponseResult getUserInfo(@PathVariable Integer userId) {
        log.info("查询APP当前登录用户信息接口，入参userId={}",userId);

        return userService.getUserInfo(userId);
    }
    @Override
    @GetMapping("/api/v1/user/{id}")
    public ApUser findUserById(@PathVariable("id") Integer id) {
        return userService.getById(id);
    }


}
